#define _CRT_SECURE_NO_WARNINGS

#include"string.h"

using namespace little_monster;

void test_construction()
{
	string s1("little monster");
	std::cout << s1.c_str() << std::endl;
	string s2(s1);
	std::cout << s2.c_str() << std::endl;
}

void test_capa()
{
	string s1("little monster");
	string s2(s1);
	std::cout << s1.size() << std::endl;//14
	std::cout << s1.capacity() << std::endl;//14
	std::cout << s1.empty() << std::endl;//0
	s1.reserve(20);
	std::cout << s1.capacity() << std::endl;//20
	s1.clear();
	std::cout << s1.size() << std::endl;//0
	std::cout << s1.empty() << std::endl;//1
	s2.resize(25, 'a');
	std::cout << s2.c_str() << std::endl;//little monsteraaaaaaaaaaa
	s2.resize(10, 'a');
	std::cout << s2.c_str() << std::endl; //little mon
}

void test_through()
{
	string s1("little monster");
	std::cout << s1[0] << std::endl;
	std::cout << s1[13] << std::endl;
	for (auto ch : s1)
	{
		std::cout << ch << " ";
	}
	std::cout << std::endl;
}

void test_revision()
{
	string s1("little monster");
	string s2(s1);
	string s3(s1);
	std::cout << s1.c_str() << std::endl;

	s1.append(" -super little monster");
	std::cout << s1.c_str() << std::endl;

	s1.push_back('-');
	std::cout << s1.c_str() << std::endl;

	std::cout << s2.c_str() << std::endl;
	s2 += " -super little monster";
	std::cout << s2.c_str() << std::endl;
	s2 += '-';
	std::cout << s2.c_str() << std::endl;

	s3.insert(0, "super ");
	s3.insert(s3.size(), '-');
	std::cout << s3.c_str() << std::endl;

	s3.erase(0, 6);
	s3.erase(s3.size() - 1, 10000);
	std::cout << s3.c_str() << std::endl;

	size_t a = s3.find("ttle",0);
	std::cout << a << std::endl;

	size_t b = s3.find("t", 0);
	std::cout << b << std::endl;

	std::cout << s3.substr(0, 6).c_str()<< std::endl;

	s3 = s1;
	std::cout << s3.c_str() << std::endl;

}

void test_opera()
{
	string s1("little monster");
	std::cout << s1 << std::endl;
	std::cin >> s1;
	std::cout << s1 << std::endl;

}

int main()
{
	//test_construction();
	//test_capa();
	//test_through();
	//test_revision();
	test_opera();
	return 0;
}